package com.jeesite.modules.stock.dto;

import lombok.Data;

@Data
public class BaseQueryParam {

    public Integer page;
    public Integer pageSize;

    public String orderBy;

    public String order;

    public Integer offset;
    public Integer limit;

    public Integer getOffset() {
        if (page != null && pageSize != null) {
            offset = (page - 1) * pageSize;
        }
        return offset;
    }

    public Integer getLimit() {
        if (pageSize != null) {
            this.limit = pageSize;
        }
        return limit;
    }

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public String getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public void setOffset(Integer offset) {
		this.offset = offset;
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}
}
